function [indices] = GetMultipleLocations(varDistances, numBuildings)

if (nargin < 2)
    numBuildings = 3;
end
size = 60;
localDistances = zeros(size, numBuildings);
indices = zeros(1, numBuildings);
avgDistance = 1000;
curDistance = 0;

% Iterate through all possible bakery locations, including duplicates
% currently very inefficient, as it requires 60^3 = 216,000 operations, 
% while there are really only (60 choose 3) = 34,220 combinations.
% However, this runs MUCH faster than the code below...
for i=1:size
    for m=1:size
    	localDistances(m,1) = varDistances(m,i);
    end
    
    if (numBuildings == 1)
        % Find the closest building to each point
        % and average those distances
        curDistance = sum(min(localDistances,[],2))/size;
        % If we've found a new minimum, update result
        if (curDistance < avgDistance)
            indices = i;
            avgDistance = curDistance;
        end
    elseif (numBuildings > 1)
        for j=1:size
            for m=1:size
                localDistances(m,2) = varDistances(m,j);
            end

            if (numBuildings == 2)
                % Find the closest building to each point
                % and average those distances
                curDistance = sum(min(localDistances,[],2))/size;
                % If we've found a new minimum, update result
                if (curDistance < avgDistance)
                    indices = [i j];
                    avgDistance = curDistance;
                end
            elseif (numBuildings > 2)
                for k=1:size
                    %Get the distances from each bakery to each point
                    for m=1:size
                        localDistances(m,3) = varDistances(m,k);
                    end

                    % Find the closest building to each point
                    % and average those distances
                    curDistance = sum(min(localDistances,[],2))/size;
                    % If we've found a new minimum, update result
                    if (curDistance < avgDistance)
                        indices = [i j k];
                        avgDistance = curDistance;
                    end
                end
            end
        end
    end
end

% options = nchoosek(1:60, 3);
% for n=1:max(size(options))
%     i = options(n, 1);
%     j = options(n, 2);
%     k = options(n, 3);
%     
%     for m=1:size
%         localDistances(m,1) = varDistances(i,m);
%         localDistances(m,2) = varDistances(j,m);
%         localDistances(m,3) = varDistances(k,m);
%     end
% 
%     % Find the closest bakery to each point
%     % and average those distances
%     curDistance = sum(min(localDistances,[],2))/size;
%     % If we've found a new minimum, update result
%     if (curDistance < avgDistance)
%         indices = [i j k];
%         avgDistance = curDistance;
%     end
% end